<template>
    <!-- 过渡动画 -->
    <transition name="fade">
        <div class="img-view">
            <!-- 遮罩层 -->
            <div class="img-layer"></div>
            <div class="img">
                <img class="showImg" :src="imgSrc" style="max-height:calc(100% - 1.4rem)">
                <img src="../assets/roadimg/closekl.png" class="closepic" @click="bigImg" alt="">
            </div>

        </div>
    </transition>
</template>
<script>
export default {
    props: ['imgSrc'],
    methods: {
        bigImg() {
            // 发送事件
            this.$emit('clickit')
        }
    }
}
</script>
<style scoped>
/*动画*/
.fade-enter-active,
.fade-leave-active {
    transition: all .2s linear;
    transform: translate3D(0, 0, 0);
}

.fade-enter,.fade-leave-active {
    transform: translate3D(0, -100%, 0);
}
/* bigimg */

.img-view {
    position: absolute;
    left:0;
    top:0;
    width: 100%;
    height: 100%;
}

/*遮罩层样式*/
.img-view .img-layer { position: fixed; z-index: 20; top: 0; left: 0; background: rgba(0, 0, 0, 1); width: 100%; height: 100%; overflow: hidden;}

/*不限制图片大小，实现居中*/
.img-view .img img { max-width: 100%; display: block; position: absolute; left: 0;margin: auto; z-index: 22;}
.img-view .img .closepic{position: fixed;bottom: 0.5rem;left: 0;right:0;/*transform: translateX(-50%);*/width: 0.7rem;z-index: 21}
.img-view .img .showImg{left: 50%;top:50%;transform:translate(-50%,-50%);z-index: 20}


</style>
